
package servlet;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet("/navServlet")
public class navServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //防止中文乱码
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");
        //获取页面传来的数据
        String navId = request.getParameter("navId");
        String rightPeop = request.getParameter("rightPeop");

        System.out.println(navId);
        System.out.println(rightPeop);
        if(rightPeop.equals("1")){
            request.setAttribute("rightPeop",1);
        }else if(rightPeop.equals("2")){
            request.setAttribute("rightPeop",2);
        }else if(rightPeop.equals("3")){
            request.setAttribute("rightPeop",3);
        }

        if(navId.equals("1")){
            request.setAttribute("navId",1);
        }else if(navId.equals("2")){
            request.setAttribute("navId",2);
        }else if(navId.equals("3")){
            request.setAttribute("navId",3);
        }else if(navId.equals("4")){
            request.setAttribute("navId",4);
        }else if(navId.equals("5")){
            request.setAttribute("navId",5);
        }else if(navId.equals("6")){
            request.setAttribute("navId",6);
        }else if(navId.equals("7")){
            request.setAttribute("navId",7);
        }else if(navId.equals("8")){
            request.setAttribute("navId",8);
        }
        request.getRequestDispatcher("/nav.jsp").forward(request,response);
    }
}
